home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1704 < prev    next >
Encoding:
Text File  |  1996-08-06  |  911 b   |  38 lines

  1. Path: nntp0.brunel.ac.uk!usenet
  2. From: Francesco Fantauzzi <mapgfgf@brunel.ac.uk>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Getting time and date?
  5. Date: 12 Jan 1996 11:46:53 GMT
  6. Organization: Brunel University
  7. Message-ID: <4d5hnd$8n6@izar.brunel.ac.uk>
  8. References: <4d4bcb$3ti@hermes.louisville.edu>
  9. NNTP-Posting-Host: maths-pc-125.brunel.ac.uk
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
  14.  
  15. bbboon01@homer.louisville.edu (Billy Boone) wrote:
  16. >I was wondering if there were any functions for getting the current time >and date.  I'm using Visual C++ 1.5.
  17.  
  18. You can use time() and ctime(). The following example is cut & pasted 
  19. from Borland C++ help:
  20.  
  21.  
  22. #include <stdio.h>
  23. #include <time.h>
  24.  
  25. int main(void)
  26. {
  27.   time_t t;
  28.  
  29.   time(&t);
  30.   printf("Today's date and time: %s\n", ctime(&t));
  31.   return 0;
  32. }
  33.  
  34.  
  35. Francesco G. Fantauzzi
  36.  
  37.  
  38.